/**
 * SysResourceDaoImpl.java
 * Created at 2017-1-5
 * Created by xubin
 * Copyright (C) 2015 BROADTEXT SOFTWARE, All rights reserved.
 */
package com.broadtext.rms.system.dao.impl;

import com.broadtext.common.exp.DaoException;
import com.broadtext.common.repository.EntityDao;
import com.broadtext.rms.system.dao.ISysResourceDao;
import com.broadtext.rms.system.model.SysResource;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * SysResourceDaoImpl.java Created at 2017-1-5 Created by xubin Copyright (C) 2017
 * BROADTEXT SOFTWARE, All rights reserved.
 */
@Repository("sysResourceDao")
public class SysResourceDaoImpl extends EntityDao<SysResource> implements ISysResourceDao {
    @SuppressWarnings("unchecked")
    @Override
    public List<SysResource> selectAllResource() throws DaoException {
        List<SysResource> list;
        list = new ArrayList<SysResource>();
        list = super.findByQuery("com.broadtext.rms.system.model.SysResource.selectAllResource", null);
        return list;
    }
    
    @SuppressWarnings("unchecked")
    @Override
    public List<SysResource> selectResourceByLoginName(String loginName) throws DaoException {
        List<SysResource> list;
        list = new ArrayList<SysResource>();
        list = super.findByProperty("com.broadtext.rms.system.model.SysResource.selectResourceByLoginName", loginName);
        return list;
    }
    
    @SuppressWarnings("unchecked")
    @Override
    public List<SysResource> selectResourceByUserId(String userId) throws DaoException {
        List<SysResource> list;
        list = new ArrayList<SysResource>();
        list = super.findByProperty("com.broadtext.rms.system.model.SysResource.selectResourceByUserId", userId);
        return list;
    }
    
    @SuppressWarnings("unchecked")
    @Override
    public List<SysResource> selectResourceByParentId(String parentId) throws DaoException {
        List<SysResource> list;
        list = new ArrayList<SysResource>();
        list = super.findByProperty("com.broadtext.rms.system.model.SysResource.selectResourceByParentId", parentId);
        return list;
    }
    
    @SuppressWarnings("unchecked")
    @Override
    public List<SysResource> selectResourceByMap(Map<String, Object> map) throws DaoException {
        List<SysResource> list;
        list = new ArrayList<SysResource>();
        list = super.findByProperty("com.broadtext.rms.system.model.SysResource.selectResourceByMap", map);
        return list;
    }
    
    @SuppressWarnings("unchecked")
    @Override
    public List<SysResource> selectAdminResource() throws DaoException {
        List<SysResource> list;
        list = new ArrayList<SysResource>();
        list = super.findByQuery("com.broadtext.rms.system.model.SysResource.selectAdminResource", null);
        return list;
    }


    @SuppressWarnings("unchecked")
    @Override
    public List<SysResource> getMsgReceiveManageResource(String id) throws DaoException {
        return findByProperty("com.broadtext.rms.system.model.SysResource.selectMsgReceiveManageResource",id);
    }
}
